# # 6.1.1函数的定义
# def show_weather():
#     print("*" * 13)
#     print("日期：4月8日")
#     print("温度：14~28℃")
#     print("空气状况：良")
#     print("*" * 13)
#
# def modify_weather(today, temp, air_quality):
#     print("*"*13)
#     print(f"日期：{today}")
#     print(f"温度：{temp}")
#     print(f"空气状况：{air_quality}")
#     print("*" * 13)
#
# show_weather()
# modify_weather('7月5日', '23~40℃', '优')

# # 6.2.1 位置参数传递
# def division(num_one, num_two):
#     print(num_one)
#     print(num_two)
#     print(num_one / num_two)
# division(6, 2)

# # 6.2.2 关键字参数传递
# def info(name, age, address):
#     print(f'姓名:{name}')
#     print(f'年龄:{age}')
#     print(f'地址:{address}')
#
# info(name="小婷", age=23, address="山东")

# # 6.2.3 默认参数传递
# def connect(ip, port=3306):
#     print(f"连接地址为:{ip}")
#     print(f"连接端口为:{port}")
#     print("连接成功")
#
# connect('127.0.0.1')
# connect(ip='127.0.0.1', port=8080)

# # 6.2.4 参数打包传递
# def test(*args):
#     print(args)
# test(11, 22, 33, 44, 55)
#
# def test(**kwargs):
#     print(kwargs)
# test(a=11, b=22, c=33, d=44, e=55)

# # 6.2.5 参数解包传递
# def test(a, b, c, d, e):
#     print(a, b, c, d, e)
#
# nums = (11, 22, 33, 44, 55)
# test(*nums)
#
# nums = {'a': 11, 'b': 22, 'c': 33, 'd': 44, 'e': 55}
# test(**nums)

# 6.3.1 局部变量
# def use_var():
#     name = '欲穷千里目，更上一层楼'
#     print(name)
# use_var()
# print(name)
#
# # 6.3.2 全局变量
# count =10
# def use_var():
#     print(count)
# use_var
# print(count)
#
# count =10
# def use_var():
#     global count
#     count += 10
#     print(count)
# use_var()
#
# # 6.3.2 匿名函数
# area = lambda  a,h:(a * h) * 0.5
# print(area(3, 4))

# 6.4.3 递归函数
# def factorial(num):
# if num == 1:
# return 1
# else:
# return num * factorial(num - 1)
# result = factorial(5)
# print(f"5的阶乘为{result}")
# 6.5 常用的内置函数
# 1. abs()函数
#      print(abs(-5))
#      print(abs(3.14))
# print(abs(8+3j))

# 2.ord()函数<
#     print(ord('a'))
#     print(ord('A'))
# # 3.chr()函数
# print(chr(97))
# print(chr(65))







